<?php

$config = include "common.php";

$img_list = "https://user.qzone.qq.com/proxy/domain/photo.qzone.qq.com/fcgi-bin/fcg_list_album_v3?g_tk={$config['g_tk']}&hostUin={$config['uin']}&uin={$config['uin']}&inCharset=utf-8&outCharset=utf-8&format=json&pageNumModeSort=40&pageNumModeClass=15";


$httpHeaders = array(
    "cookie:" . $config['cookie']
);

$httpClient = new HttpClient($img_list, 'GET');
$httpClient->setRequestHeader($httpHeaders);
$httpClient->exec();
$responseBody = json_decode($httpClient->getResponseBody(), true);

if ($responseBody['code'] == 0) {
    $image_list = $responseBody['data']['albumListModeSort'];

    if (empty($image_list)) {
        exit('您相册是空的哦！');
    }
    $image_name = $image_info = [];
    foreach ($image_list as $v) {
        $image_name[] = '<<' . $v['name'] . '>>此相册共有' . $v['total'] . '张相片';
        $image_info[$v['name']]['id'] = $v['id'];
        $image_info[$v['name']]['total'] = $v['total'];
    }
    file_put_contents('db.txt', json_encode($image_info));
    var_dump($image_name);
    die();
}
exit("登录失效了，换个cookie试试吧！");
